package com.lfy.yunpicture.model.enums;

import lombok.Getter;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

@Getter
public enum SpaceTypeEnum {
    PRIVATE("私有空间",0),
    TEAM("团队空间",1);
    private final String text;
    private final Integer value;
    SpaceTypeEnum(String text, Integer value) {
        this.text = text;
        this.value = value;
    }
    public static List<Integer> getValues() {
       return Arrays.stream(values()).map(SpaceTypeEnum::getValue).collect(Collectors.toList());
    }
    public static SpaceTypeEnum getEnumByValue(Integer value) {
        if (value == null) {
            return null;
        }
        for (SpaceTypeEnum valueEnum : values()) {
            if (valueEnum.getValue().equals(value)) {
                return valueEnum;
            }
        }
        return null;
    }
    public Integer getValue() {
        return value;
    }

    public String getText() {
        return text;
    }
}
